<template>
    <div>
            <table class="table_detail" style="width: 100%;">
                    <tr> <td colspan="5" class="headColor"> <span>{{type==2?'转让方简况':'出租方基本情况' }}</span></td></tr>
                    <tr> 
                        <td class="headColor"> <span>{{type==2?'转让方名称':'出租方名称' }}</span></td>
                        <td colspan="4"><span v-if="cData.fList">{{type==2?cData.fList[0].transferorName:cData.fList[0].lessorName}}</span></td>
                    </tr>                     
                    <tr>
                        <td :rowspan="rowLen" class="showC headColor"><span>基本情况</span></td>
                    </tr>
                    <template v-for="(item,index) of cData.fList">
                        <tr v-for="(v,i) in firstInfo"  v-if="v.show == 1">
                            <td class="headColor"><span>{{ v.name }}</span></td>
                            <td class="normalC"><span>{{item[v.model]}}</span></td>
                            <td class="headColor"><span>{{ v.name2 }}</span></td>
                            <td class="normalC"><span>{{item[v.model2]}}</span></td>
                        </tr>
                        <tr v-else-if="v.show == 3">
                            <td class="headColor"><span>{{ v.name }}</span></td>
                            <td colspan="3" class="normalC"><span>{{item[v.model]}}</span></td>
                        </tr>
                        <tr v-else>
                            <td colspan="4" class="showC headColor" style="text-align: center;"><span>{{ v.name}}</span></td>
                        </tr>  
                    </template>
                    <template v-for="(item,index) of cData.ffList">
                        <tr v-for="(v,i) in f_firstInfo"  v-if="v.show == 1">
                            <td class="headColor"><span>{{ v.name }}</span></td>
                            <td class="normalC"><span>{{item[v.model]}}</span></td>
                            <td class="headColor"><span>{{ v.name2 }}</span></td>
                            <td class="normalC"><span>{{item[v.model2]}}</span></td>
                        </tr>
                        <tr v-else-if="v.show == 3">
                            <td class="headColor"><span>{{ v.name }}</span></td>
                            <td colspan="3" class="normalC"><span>{{item[v.model]}}</span></td>
                        </tr>
                        <tr v-else>
                            <td colspan="4" class="showC headColor" style="text-align: center;"><span>{{ v.name}}</span></td>
                        </tr>  
                    </template>
                    <!-- 自然人 -->
                    <template v-for="(item,index) of cData.zList">
                        <tr v-if="index>0">
                            <td :rowspan="3" class="showC headColor"><span>基本情况</span></td>
                        </tr>
                        <tr v-for="(v,i) in z_firstInfo"  v-if="v.show == 1">
                            <td class="headColor"><span>{{ v.name }}</span></td>
                            <td class="normalC"><span>{{item[v.model]}}</span></td>
                            <td class="headColor"><span>{{ v.name2 }}</span></td>
                            <td class="normalC"><span>{{item[v.model2]}}</span></td>
                        </tr>
                        <tr v-else-if="v.show == 3">
                            <td class="headColor"><span>{{ v.name }}</span></td>
                            <td colspan="3" class="normalC"><span>{{item[v.model]}}</span></td>
                        </tr>
                        <tr v-else>
                            <td colspan="4" class="showC headColor" style="text-align: center;"><span>{{ v.name}}</span></td>
                        </tr>
                        <tr>
                            <td rowspan="3" class="showC headColor"><span>内部决策情况</span></td>
                        </tr>
                        <tr v-for="(v,i) in z_secondInfo">
                            <td class="headColor"><span>{{ v.name }}</span></td>
                            <td colspan="3" class="normalC"><span>{{item[v.model]}}</span></td>
                        </tr>
                        <tr>
                            <td rowspan="5" class="showC headColor"><span>出租转让行为批准情况</span></td>
                        </tr>
                        <tr v-for="(v,i) in z_thirdInfo">
                            <td class="headColor"><span>{{ v.name }}</span></td>
                            <td colspan="3" class="normalC"><span>{{item[v.model]}}</span></td>
                        </tr>
                    </template>                                                                     
            </table>
    </div>
</template>

<script>
    export default {
        props:{
            type:"",
            // cText:'',
            // cData:'',
            // cCol:'',
            cData: Object
        },
        data() {
            return {
                cCol: [
                    {
                        name1: "data1",
                    },{
                        name1: "data2",
                        name2: "data3"
                    },{
                        name1: "data4",
                        name2: "data5"
                    },{
                        name1: "data7",
                        name1: "data8"
                    },{
                        name1: "data9",
                        name1: "data10"
                    }
                ],               
                                firstInfo:[{
                    name:'法人',
                    show:0,
                },{
                    name:'住所',
                    name2:'注册资本',
                    show:1,
                    model:"residence",
                    model2:'registeredCapital'
                },{
                    name:'法定代表人',
                    name2:'统一社会信用代码',
                    show:1,
                    model:"legal",
                    model2:"unifiedSocialCreditCode"
                },{
                    name:'企业类型',
                    name2:'所属行业',
                    show:1,
                    model:"enterpriseType",
                    model2:"industry"                      
                },{
                    name:'经济性质',
                    show:3,
                    model:"economicType",
                }],
                f_firstInfo:[{
                    name:'非法人组织',
                    show:0,
                },{
                    name:'主要经营场所',
                    show:3,
                    model:"mainBusinesPremise"
                },{
                    name:'负责人',
                    name2:'统一社会信用代码',
                    show:1,
                    model:"principal",
                    model2:"unifiedSocialCreditCode"
                },{
                    name:'企业类型',
                    name2:'所属行业',
                    show:1,
                    model:"enterpriseType",
                    model2:"industry",
                },{
                    name:'经济性质',
                    show:3,
                    model:"economicType"
                }],
                z_firstInfo:[{
                    name:'自然人',
                    show:0,
                },{
                   name:'证件类型',
                    name2:'证件号码',
                    show:1,
                    model:"certificateType",
                    model2:"certificateNum"
                }],
                z_secondInfo: [{
                    name:'内部决策类型',
                    show:3,
                    model:"decisionType",
                },{
                    name:'内部决策文件名称及文号',
                    show:3,
                    model:"fileAndDocument",
                }],
                z_thirdInfo:[{
                    name:'国家出资企业或主管部门',
                    show:3,
                    model:"competentDepartment",
                },{
                    name:'批准单位',
                    show:3,
                    model:"authority",
                },{
                    name:'批准文件类型',
                    show:3,
                    model:"approvedFileType",
                },{
                    name:'批准文件名称及文号',
                    show:3,
                    model:"approveFileAndDocument",
                }],                               
            }
        },
        computed: {
            rowLen () {
                if (this.cData.fList) {
                    let len1 = this.cData.fList.length * 5
                    let len2 = this.cData.ffList.length * 5 
                    return len1 + len2 + 3
                }
            }
        }
    }
</script>

<style scoped>
    .normalC{ background-color: #ffffff !important;}
    .showC{ background-color: #f5f5f5 !important;}
    .table_detail td:nth-child(odd) {
        width: 240px;
        height: 40px;
        background-color: #f5f5f5;
        flex: none;
    }    
    
</style>